 $("footer").load("footer.html");
    // -------支付倒计时-------
    function daojishi() {
        var minutes = 9; //分钟
        var seconds = 59;  //秒
        var myTime;
        if (myTime != undefined) {//有定时器在运行，那么，不能再次启动定时器
            return;
        }

        myTime = setInterval(function () {  //循环定时器

            seconds--   //秒倒计时
            if (seconds == 0) {
                minutes--
                seconds = 60;  //当满60的时候，进位给分钟，秒清零

                if (minutes == 0) {
                    clearInterval(myTime);
                    minutes = 0;//当满60的时候，进位给小时，分钟清零
                }
            }
            $("#minutes").html(minutes) < 10 ? "0" + minutes : minutes;
            $("#seconds").html(seconds) < 10 ? "0" + seconds : seconds;

        }, 1000)
    }
    $(function () {
        daojishi();
    })
    // ------------------------------------------

    $.post(
        "./goodsAndShoppingCart/getShoppingCart.php",
        { "vipName": getCookie("name") }, function (data) {
            getusername(data)
        }, "json");
    function getusername(data) {
        let innerstr1 = "";
        for (let i = 0; i < data.length; i++) {

            innerstr1 += `
                    <ul>
                    <li><input type="checkbox" style="position: absolute;top: 75px;left: 75px;"></li>
                    <img src="${data[i].goodsImg}" alt="">
                    <div class="one" style="position: absolute;top: 45px;left: 268px;"><br>
                        <li>尺码</li>
                        <select style="width: 80px;height: 20px;">
                            <option value="尺码">S</option>
                            <option value="尺码">M</option>
                            <option value="尺码">L</option>
                        </select>
                    </div>
                    <li style="position: absolute;top: 65px;left: 481px;">￥ <i>${data[i].goodsPrice}</i> 元</li>
                    <span class="shuliang" style="color: black;position: relative;left: 631px;top: 61px;">
                      
                        <a class="jian" index>-</a>
                        <em class="total" style="color: #666;">${data[i].goodsCount}</em>
                        <a class="jia">+</a>
                    </span>
                    <li style="position: absolute;top: 65px;left: 836px;">￥${data[i].goodsPrice * data[i].goodsCount}元</li>
                   
                 
                    <b class="delete" style="position: absolute;top: 140px;left: 900px;">删除
                    <i class="del" style="display: none;">${data[i].goodsId}
                    </i>
                    </b>
                      
                  

                    </ul>
            
                    `
                   
        }

        $(".cargoods").html(innerstr1);
        // console.log(data)

        // $("#jia").click(function () {
        //     let count = $(this).prepend().text();
        //     // let count = $("#total").html();
        //     count++;
        //     $("#total").html(count);
        //     // console.log(count)

        // });
    }
    // console.log($("#total").html(2))
    // function aaa(){
    //     console.log($("#jian"));

    //    }
    // =============页面渲染后事件加在固定页面的上才可以绑定==================
    $(".cargoods").on("click", ".jian", function () {
        // let count = $(this).next().text();
        let count = $(".total").html();
        count--;
        if (count <= 0) {
            count = 0;
        }
        $(".total").html(count);
        console.log(count);
    })

    $(".cargoods").on("click", ".jia", function () {
        // let count = $(this).prepend().text();

        let count = $(".total").html();
        count++;
        $(".total").html(count);

        console.log(count)

    })
    // $("#delet").click(function () {
    //     console.log("5456655656");
    //     let ss = $(".del").html();
    //     $(this).parents().eq(1).remove()
    //     $.get(
    //         "./goodsAndShoppingCart/deleteGoods.php",
    //         { "vipName": getCookie("name"), "goodsId": ss }, function (data) {

    //         }, "json");
    // }
    // )
    $(".cargoods").on("click", ".delete", function () {
        let rem = $(".del").html();
            $(this).parents().eq(1).remove()
            $.get(
                "./goodsAndShoppingCart/deleteGoods.php",
                { "vipName": getCookie("name"), "goodsId": rem }, function (data) {
    
                }, "json");


    })
    $("")
